<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="template.xhtml">
	<ui:define name="content">
		<h:form>
			<p:panel header="Statistics">
				<p:panel header="Users">
					<!-- Drop down list -->
					<p:selectOneMenu value="dummy"
						valueChangeListener="#{statistics.emailChange}">
						<f:selectItem itemLabel="Select user" itemValue="" />
						<f:selectItems value="#{statistics.emailList}" />
						<p:ajax update="statPerUser" event="change" />
					</p:selectOneMenu>

				</p:panel>
				<p:panel id="statPerUser" header="Services per user">
					<!-- Services per user as table  -->
					<h:outputText value="#{statistics.selectedEmail}"></h:outputText>
					<br />
					<p:dataTable value="#{statistics.statisticsListPerUser}"
						var="statistic">
						<p:column headerText="Date">
							<h:outputText value="#{statistic.date}"></h:outputText>
						</p:column>
						<p:column headerText="Mail counter">
							<h:outputText value="#{statistic.mailCounter}"></h:outputText>
						</p:column>
						<p:column headerText="Mail counter per day">
							<h:outputText value="#{statistic.mailCounterPerDay}"></h:outputText>
						</p:column>
					</p:dataTable>
				</p:panel>
			</p:panel>
		</h:form>

	</ui:define>
</ui:composition>
</html>